#include<stdlib.h>
#include<stdbool.h>
#include<stdio.h>
#define  end -1
typedef int BTDataType;

typedef struct BinaryTreeNode
{
	BTDataType data;
	struct BinaryTreeNode* left;
	struct BinaryTreeNode* right;
}BTNode;

#pragma warning(disable:4996)
void Insert(BTNode** pproot, int key)
{
	if (*pproot == NULL)
	{
		BTNode* tmp = (BTNode*)malloc(sizeof(BTNode));
		if (tmp == NULL)
		{
			perror("malloc fail\n");
		}
		else
		{
			tmp->data = key;
			tmp->left = NULL;
			tmp->right = NULL;
			*pproot = tmp;
			return;
		}
	}
	if ((*pproot)->data > key)
	{
		Insert(&(*pproot)->left, key);
	}
	else
	{
		Insert(&(*pproot)->right, key);
	}
}
void CreatTree(BTNode** pproot)
{
	*pproot = NULL;
	int key = 0;
	scanf("%d", &key);
	while (key != end)
	{
		Insert(pproot, key);
		scanf("%d", &key);
	}
}

bool Find(BTNode* proot, int key)
{
	if (proot == NULL)
	{
		return false;
	}
	if (key == proot->data)
	{
		return true;
	}
	if (key > proot->data)
	{
		return Find(proot->right, key);
	}
	else
	{
		return Find(proot->left, key);
	}
}

int main()
{
	BTNode root;
	BTNode* proot = &root;
	int n = 0;
	while (scanf("%d", &n) != EOF)
	{
		CreatTree(&proot);
		int a = 0;
		printf("请输入要查找的数字\n");
		scanf("%d", &a);
		if (Find(proot, a))
		{
			printf("找到了\n");
		}
		else
		{
			printf("没有找到\n");
		}
	}
	return 0;
}